<?php

class Application_Model_DbTable_CauHinh extends Zend_Db_Table_Abstract
{

    protected $_name = 'CAUHINH';

    
    public function updateCache( $cache ) {
        
        // Check exist key
        if(!$row = $this->fetchRow("Khoa='clear_cache'")){
            $row = $this->createRow(array('Khoa'=>'clear_cache','GiaTri'=>'1'));
            $row->save();
        }
        
        // Clear cache if db has change
        if($row->GiaTri == '1') {
            $cache->clean( Zend_Cache::CLEANING_MODE_ALL );
            $row->GiaTri = '0';
            $row->save();
        }
        
    }
}

